<?php

// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------


namespace app\index\model\sms;

use think\Model;
use think\facade\Cache;
use think\facade\Config;
use think\facade\Db;

/**
 * Class User
 * @package app\api\model\user
 * @author xaboy
 * @day 2020-04-28
 */
class SmsRecord extends Model
{
    protected $pk = "sms_record_id";

    function addData($data){
        return $this->insertGetId([
            'uid' => '0',
            'phone' => $data['phone'],
            'content' => $data['content'],
            'template' => $data['template'],
            'create_time' => date('Y-m-d H:i:s'),
            'is_use' => 0,
            'resultcode' => 100,
            'record_id' => isset($data['record_id']) ? $data['record_id'] : 0,
            'type' => $data['type'],
            'code' => $data['code'],
        ]);
    }

    /**
     * 更新记录
     * @param $id
     * @param $aveData
     * @return static
     */
    function updateRecord($id,$aveData){
        return $this->where('sms_record_id',$id)->update($aveData);
    }

}
